package
{
	import flash.events.MouseEvent;
	import flash.text.StyleSheet;
	import flash.text.TextFieldAutoSize;
	
	import qnx.ui.buttons.LabelButton;
	import qnx.ui.listClasses.ScrollDirection;
	import qnx.ui.listClasses.ScrollPane;
	import qnx.ui.text.Label;

	public class Status extends BaseView
	{
		private var scrlr:ScrollPane;
		private var statusText:Label;
		private var txt:String;

		//private var bt_close:LabelButton;
		public function Status()
		{
			super();
			configUI();
			var i:int;
			for(i=0; i<20; i++){
				this.appendHTML("some text " + i + "<br>");
			}
		}

		private function configUI():void
		{
			scrlr = new ScrollPane();
			//scrlr.setPosition(0, 0);
			scrlr.width = 1020;
			scrlr.height = 460;
			scrlr.scrollDirection = ScrollDirection.VERTICAL;

			var css:StyleSheet = new StyleSheet();
			css.setStyle("body", {fontFamily:'Courier New', fontSize:'18'});

			
			statusText = new Label();
			statusText.autoSize = TextFieldAutoSize.LEFT;
			statusText.multiline = true;
			statusText.textField.wordWrap = true;
			statusText.width = 1020;
			statusText.textField.styleSheet = css;
			statusText.htmlText = "<body>";
			//statusText.height = 470;
			scrlr.setScrollContent(statusText);
			
			/*
			bt_close = new LabelButton();
			bt_close.label = "X";
			bt_close.x = 824;
			bt_close.y = 50;
			bt_close.width = 50;
			bt_close.addEventListener(MouseEvent.CLICK, onClose);
			*/
			
			this.addChild(scrlr);
			//this.addChild(bt_close);
		}
		
		public function appendHTML(txt:String):void
		{
			statusText.htmlText += txt;
			if(statusText.textHeight > scrlr.height){
				scrlr.scrollY = statusText.textHeight;
				scrlr.update();
			}
			
		}
	}

}